package com.linewell.mongodemo.pojo;

import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;


@Document(collection = "approvallog")
public class ApprovalLog implements Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 928776620891795953L;

	/**
	 * 唯一标识
	 */
	@Id
	private String id;

	/**
	 * 审核日期
	 */
	@Field("approval_time")
	private Date approvalTime;

	/**
	 * 审核人ID
	 */
	@NotNull
	@Length(min=0,max=50)
	@Field("user_id")
	private String userId;

	/**
	 * 审核人员
	 */
	@NotNull
	@Length(min=0,max=100)
	@Field("user")
	private String user;

	/**
	 * 意见类型：0  暂存草稿,1.送审核 ,2 送签章 ,-1 退回,11.发布,-2.注销,-3.吊销,-4.过期,-5.变更作废,-6.年检作废,99.取回,5.申请变更,6.申请年检
	 */
	@NotNull
	@Length(min=0,max=2)
	@Field("approval_result")
	private String approvalResult;
	
	

	/**
	 * 审核意见
	 */
	@NotNull
	@Length(min=0,max=500)
	@Field("approval_opinion")
	private String approvalOpinion;
	
	/**
	 * 审核日志类型:0目录,1模板,2批文,3证照缺失
	 */
	@NotNull
	@Min(0) 
	@Max(3) 
	@Field("type")
	private Integer type;
	
	/**
	 * 类型对应文档ID值--目录id
	 */
	@NotNull
	@Length(min=0,max=50)
	@Field("type_id")
	private String typeId;
	
	/**
	 * 版本号,格式V2016_1.0
	 */
	@NotNull
	@Length(min=1,max=50)
	@Field("version")
	private String version;

	/**
	 * 是否推送日志给第三方接口
	 */
	@Field("is_push")
	private Integer isPush;

	/**
	 * 类型，0目录，1综合
	 */
	@Field("apply_type")
	private Integer applyType;

	/**
	 * 类型对应文档名称--目录名称
	 */
	@Field("type_name")
	private String typeName;

	public ApprovalLog(Date approvalTime, String userId, String user, String approvalResult, String approvalOpinion, Integer type, String typeId, String version, Integer isPush, Integer applyType, String typeName) {
		this.approvalTime = approvalTime;
		this.userId = userId;
		this.user = user;
		this.approvalResult = approvalResult;
		this.approvalOpinion = approvalOpinion;
		this.type = type;
		this.typeId = typeId;
		this.version = version;
		this.isPush = isPush;
		this.applyType = applyType;
		this.typeName = typeName;
	}

	public ApprovalLog() {
		super();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getApprovalTime() {
		return approvalTime;
	}

	public void setApprovalTime(Date approvalTime) {
		this.approvalTime = approvalTime;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getApprovalResult() {
		return approvalResult;
	}

	public void setApprovalResult(String approvalResult) {
		this.approvalResult = approvalResult;
	}

	public String getApprovalOpinion() {
		return approvalOpinion;
	}

	public void setApprovalOpinion(String approvalOpinion) {
		this.approvalOpinion = approvalOpinion;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
		
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

    public Integer getIsPush() {
        return isPush;
    }

    public void setIsPush(Integer isPush) {
        this.isPush = isPush;
    }

    public Integer getApplyType() {
        return applyType;
    }

    public void setApplyType(Integer applyType) {
        this.applyType = applyType;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public ApprovalLog(String id, Date approvalTime, String userId, String user, String approvalResult,
                       String approvalOpinion, Integer type) {
		super();
		this.id = id;
		this.approvalTime = approvalTime;
		this.userId = userId;
		this.user = user;
		this.approvalResult = approvalResult;
		this.approvalOpinion = approvalOpinion;
		this.type = type;
	}
	
	public ApprovalLog(String id, Date approvalTime, String userId, String user, String approvalResult,
                       String approvalOpinion, Integer type, String typeId, String version) {
		super();
		this.id = id;
		this.approvalTime = approvalTime;
		this.userId = userId;
		this.user = user;
		this.approvalResult = approvalResult;
		this.approvalOpinion = approvalOpinion;
		this.type = type;
		this.typeId = typeId;
		this.version = version;
	}

	public ApprovalLog(String approvalOpinion, String userId, String user, Date approvalTime, String approvalResult,
                       Integer type, String typeId) {
		super();
		this.approvalTime = approvalTime;
		this.userId = userId;
		this.user = user;
		this.approvalResult = approvalResult;
		this.approvalOpinion = approvalOpinion;
		this.type = type;
		this.typeId = typeId;
	}

}
